package com.ryan.service;

import com.ryan.entity.Products;
import com.ryan.feign.ProductFeignFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author raofy
 * @date 2021-09-28 14:32
 * @desc
 */
@FeignClient(name = "product", fallback = ProductFeignFallBack.class)  // name属性指定的名称需要和spring.application.name保持一致，并且只能出现一次
public interface ProductFeign {

    /**
     * 根据id获取商品号
     *
     * @param id
     * @return
     */
    @GetMapping("product/query/{id}")
    public Products query(@PathVariable Integer id);

    /**
     * 获取端口号
     *
     * @return
     */
    @GetMapping("server/port")
    String findServerPort();
}
